package com.itheima.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.common.entity.PageResult;
import com.itheima.common.entity.QueryPageBean;
import com.itheima.mapper.OrderMapper;
import com.itheima.pojo.CheckGroup;
import com.itheima.pojo.OrderStatusDTO;
import com.itheima.pojo.OrderVO;
import com.itheima.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    /**
     * 预约列表分页查询
     * @param queryPageBean
     * @return
     */
    public PageResult pageQuery(QueryPageBean queryPageBean) {
        PageHelper.startPage(queryPageBean.getCurrentPage(),queryPageBean.getPageSize());
        Page<OrderVO> page = orderMapper.pageQuery(queryPageBean);
        return new PageResult(page.getTotal(),page.getResult());
    }

    /**
     * 修改预约状态
     * @param orderStatusDTO
     */
    public void updateById(OrderStatusDTO orderStatusDTO) {
        orderMapper.updateStatus(orderStatusDTO);
    }
}
